#x,n,bitNum输入变量
library(moments)
if(is.null(n) || n == 0) {
    n <- ceiling(sqrt(length(x)))
}

Q<-c(-3,-2,-1,0,1,2,3)

#普通值
avgValue <- mean(x)
minValue <- min(x)
maxValue <- max(x)
stdevValue <- sd(x)
rangeValue <- max(x) - min(x)
kurtosisValue <- kurtosis(x)
skewnessValue <- skewness(x)

divideValue <- x
barValue <- x

#正态分布图
x1 <- c(x, stdevValue * 3 + avgValue, avgValue - 3 * stdevValue)
curveXValue <- seq(min(x1),max(x1),length=100)
curveYValue <- dnorm(curveXValue, mean=avgValue,sd=stdevValue)

#curveXValue <- round(sort(c(x, mean(x) + Q*sd(x))), 6)
#curveXValue <- sort(x)
#curveYValue <- as.character(dnorm(curveXValue, mean(curveXValue), sd(curveXValue)))

#curveYValue <- as.character(curveYValue)

#直方图
#divideValue <- seq(min(x), max(x), by=(max(x)-min(x))/n)
#barValue <- as.data.frame(table(cut(x, divideValue, include.lowest=T)))[,2]
divideValue <- seq(min(x), max(x), by=(max(x)-min(x))/n)
barValue <- c(0,as.data.frame(table(cut(x, divideValue, include.lowest=T)))[,2])



